package com.wgc.vip.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wgc.vip.domain.Evaluation;
import com.wgc.vip.domain.Funds;
import com.wgc.vip.domain.Vip;
import com.wgc.vip.service.FundsService;
import com.wgc.vip.mapper.FundsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 15776
* @description 针对表【funds】的数据库操作Service实现
* @createDate 2024-07-29 22:37:55
*/
@Service
public class FundsServiceImpl extends ServiceImpl<FundsMapper, Funds>
    implements FundsService{
@Autowired
private FundsMapper fundsMapper;
    @Override
    public List<Funds> getAll() {
        LambdaQueryWrapper<Funds> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Funds::getIsDelete, 0);
        return fundsMapper.selectList(queryWrapper);
    }

    @Override
    public Page<Funds> pageAll(Integer page, Integer size) {
        Page<Funds> page1 = new Page<>(page, size);
        return this.page(page1, null);
    }

    @Override
    public Page<Funds> pageList(Funds e, Integer page, Integer size) {
        Page<Funds> page1 = new Page<>(page, size);
        return this.page(page1, lqw(e));

    }

    @Override
    public List<Funds> selectList(Funds funds) {
        return fundsMapper.selectList(lqw(funds)) ;
    }
    public LambdaQueryWrapper<Funds> lqw(Funds funds) {
        LambdaQueryWrapper<Funds> lqw = new LambdaQueryWrapper<>();
        if (funds.getId() != null) {
            lqw.eq(Funds::getId, funds.getId());
        }
        if (funds.getVipName() != null) {
            lqw.eq(Funds::getVipName, funds.getVipName());
        }
        if (funds.getChangeTime() != null) {
            lqw.eq(Funds::getChangeTime, funds.getChangeTime());
        }

        return lqw;
    }
}




